;(function(win){
    win._={}
    _.els=null
    _.on=function(eventName,selector,callback){
        var oEls=document.querySelectorAll(selector)
        oEls=_.toArray(oEls)
        document.addEventListener(eventName,function(event){
            if(oEls.indexOf(event.target)>=0){
                callback.call(event.target,event)
            }
        },false)
    }
    _.q=function(selector){
        _.els=document.querySelectorAll(selector)
       return _
    }
    _.style=function(key,value){
        _.els.forEach(function(el){
            el.style[key]=value
        })
        return _
    }
    //调用：_.toArray(Object)
    //描述：将伪数组转化成数组
    //参数：（Object）obj  将尾数组转化成数组
    //      (Number)num....
    //返回：（Array）数组
    _.toArray=function(obj){
        var arr=[]
        for(var i=0;i<obj.length;i++){
            arr.push(obj[i])
        }
        return arr
    }
    //判断基本的数据类型
    _.typeOf=function(obj){
        if(obj!=obj){
            return 'NaN'
        }
        switch(obj){
            case null:
            return 'null'
            break
            case undefined:
            return underfined
            break
        }
       switch (true) {
            case obj instanceof Array:
                return 'Array'
                break
            case obj instanceof Function:
                return 'Function'
                break
            case obj instanceof RegExp:
                return 'RegExp'
                break
            case obj instanceof Object:
                return 'Object'
                break
        }

        return (typeof obj)

    }
})(window||{});
